<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@include file="init.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Xem</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/scrip.js"></script>
</head>
<body>
<div class="master-wrapper-content">
	<jsp:include page="heading.jsp"></jsp:include>
	<jsp:include page="listCategory.jsp"></jsp:include>
	<div class="container-right">	
		<%
			if(session.getAttribute("productIds") == null) {
				%>
					<h3 style="color: red">Không thể xem</h3>
				<%
			}
				
			else {
				List<Integer> productIds = (List<Integer>) session.getAttribute("productIds");
				
				%>
				<form action="AddComponentComputer" method="post">
				<table id="check-product">
					<tr class="title">
											<th>Tên Sản phẩm</th>
											<th>Hình ảnh sản phẩm</th>
											<th>Giá tiền</th>
											<th>Tùy chọn</th>
					</tr>
				<%
				for(int i = 0; i < productIds.size(); ++ i) {
					%>
					<tr>
					<%
					Product product = dataManager.getProductById(productIds.get(i));
					String urlImage = request.getContextPath() + "/DisplayImage?path=" + product.getImage();			
					%>
					<td id="product-name"><%=product.getProductName() %></td>
					<td><img  id="check-image" src="<%=urlImage %>" /></td>					
					<td id = "gia" width="200px"><%=product.getPrice() %></td>
					<td  width="200px"><input type="checkbox" name="<%=productIds.get(i) %>" /></td>
					</tr>
					<%
				}
				%>
				</table>
				<input type="submit" value="Đặt hàng">
				</form>
				<%
			}
		%>
	</div>
	<div class="clear" ></div>
	<jsp:include page="footer.jsp"></jsp:include>
</div>
</body>
</html>